package demoMod.stsconsole.commands;

import demoMod.stsconsole.enums.ErrType;
import demoMod.stsconsole.helpers.LocalizedStrings;
import demoMod.stsconsole.helpers.SaveHelper;

import java.util.List;
import java.util.Scanner;

public class Abandon extends AbstractCommand {
    @Override
    public void execute(String[] args, Scanner sc) {
        if (args.length != 0) {
            this.errMsg(ErrType.WRONG_ARGUMENT);
            return;
        }
        List<String> cmdStrings = LocalizedStrings.getCommandStrings("Abandon");
        System.out.print(cmdStrings.get(0));
        if (sc.nextLine().equalsIgnoreCase("y")) {
            if (!SaveHelper.saveExists()) {
                this.errMsg(ErrType.SAVE_NOT_EXIST);
                return;
            }
            SaveHelper.deleteSave();
        }
    }

    @Override
    public boolean requiredPrompt(String currentPrompt) {
        return "".equals(currentPrompt);
    }
}
